home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / GRAPHICS / 13HLIB.ZIP / 13HLIB.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-17  |  2.3 KB  |  80 lines

  1. // 13hLib     : Graphics library for Mode 13h
  2. // Programmer : Pri$m
  3. // Language   : C++
  4. // Compiler   : Turbo C++ 3.1
  5.  
  6. #ifndef __13hlib_h__
  7.  
  8. //Includes
  9. #include <alloc.h>
  10. //Defines
  11. #define SUCCESS 1
  12. #define FAILURE 0
  13. #define KillSprite(x) farfree(x)
  14. // These macros are for use with the int type functions below.
  15.  
  16. //Type definitions
  17. typedef unsigned char far* Sprite;
  18.  
  19. struct ColorStruct{   // Contains RGB data for a color
  20.  unsigned char r;
  21.  unsigned char g;
  22.  unsigned char b;
  23. };                    // Use this when changing the palette.
  24.  
  25. struct PCXHeaderStruct{
  26.  char manu;
  27.  char version;
  28.  char encoding;
  29.  char bitstopixel;
  30.  int x, y;
  31.  int w, h;
  32.  int horizontalres;
  33.  int verticalres;
  34.  char ega_palette[48];
  35.  char reserved;
  36.  char colplanes;
  37.  int bytetoline;
  38.  int palette;
  39.  char buff[58];
  40. };
  41.  
  42. class Mode13hLib{
  43.   public:
  44.    Mode13hLib();
  45.    void PlotPixel(int x, int y, unsigned char col);
  46.    void GetPaletteColor(int index, ColorStruct& ColStr);
  47.    void SetPaletteColor(int index, ColorStruct& ColStr);
  48.    void HorizontalLine(int x, int y, int xx, unsigned char color);
  49.    void VerticalLine(int x, int y, int yy, unsigned char color);
  50.    void WaitVerticalRetrace();
  51.    void DrawSprite(int x, int y, int width, int height, const Sprite Sprte);
  52.    void DrawSpriteNoTrans(int x, int y, int width, int height, const Sprite Sprte);
  53.    void ClearScreen(unsigned char color);
  54.    void Line(int x1, int y1, int x2, int y2, unsigned char color);
  55.    void Bar(int x, int y, int width, int height, unsigned char color);
  56.    void Rectangle(int x, int y, int width, int heigth, unsigned char color);
  57.    void SetMode13h();
  58.    void CloseMode13h();
  59.    void CopyPageToScreen();
  60.    void ClosePage();
  61.    void BltText(char far *text, int x, int y, unsigned char color);
  62.    unsigned char GetPixel(int x, int y);
  63.    int DetectVGA();
  64.    int WriteSpriteToDisk(char *filename, int width, int height, const Sprite Sprte);
  65.    int LoadPCXFile(char *filename);
  66.    int LoadPalette(char *filename);
  67.    int SavePalette(char *filename);
  68.    int SetUpPage();
  69.    int PageActive();
  70.    Sprite  ReadSpriteFromDisk(char *filename);
  71.    Sprite  GetSprite(int x, int y, int width, int height);
  72.  
  73.     protected:
  74.    unsigned char far *vram;                      // Pointer to vram.
  75. };
  76.  
  77.  
  78. #define __13hlib_h__
  79. #endif
  80.